package com.tmjavabasics.mythreads;

public class SharedData {
	private String data;
	
	public SharedData(){
		data = "Initial";
	}
	
	public synchronized void showData(String value) throws Exception{
		data = value;
		String current = Thread.currentThread().getName();
		if(current.equals(Thread.currentThread().getName()) == false)
			throw new Exception("Conflict");
		
		System.out.println("********" + current + "******");
		System.out.println(data);
	}
}
